﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

namespace WebApplication2
{
    public partial class ThemDL : System.Web.UI.Page
    {
        string strCon = @"Data Source=THEGUNNER-PC\SQLEXPRESS;Initial Catalog=QLThuVien;Integrated Security=True";
        SqlConnection conn = null;
        SqlDataAdapter da = null;
        DataTable dt = null;
        SqlCommand cmd = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            conn = new SqlConnection(strCon);
        }

        protected void btnluu_Click1(object sender, EventArgs e)
        {
            conn.Open();

            String strcmd = "insert into Sach values('" + txtma.Text + "','" + txtten.Text.Trim() + "','" + DropDownList1.DataValueField + "','" + txtsotrang.Text + "','" + txtdongia.Text + "')";
            cmd = new SqlCommand(strcmd, conn);
            cmd.ExecuteNonQuery();
            //GridView1.DataBind();


            conn.Close();
            Response.Redirect("HienThi.aspx");
        }

      
    }
}